/*
 * @Date: 2025-04-22 16:01:15
 * @Auth: 873768511@qq.com
 * @LastEditors: 463997479@qq.com
 * @LastEditTime: 2025-09-10 18:09:36
 * @FilePath: \corpus\src\pages\catalogue\detail\components\BasicInfo\index.tsx
 */

import { Descriptions } from 'antd';
import Container from '../../hooks';
import ContainerConfigureInfo from '../ContainerConfigureInfo';
export default () => {
  const {
    detailsData: { data },
  } = Container.useContainer();
  const getParseJson = (data: any[]) => {
    if (!data) return '-';
    try {
      const arr = data?.map((item: { id: string; name: string }) => item?.name);
      return arr.join('、');
    } catch (error) {
      return data;
    }
  };
  return (
    <>
      <ContainerConfigureInfo title="基础信息">
        <Descriptions column={2}>
          <Descriptions.Item label="数据资源名称"> {data?.name ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="数据资源编码">{data?.code ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="数据资源提供方">{data?.sourceOrgName ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="创建人">{data?.createNick ?? '-'}</Descriptions.Item>
        </Descriptions>
      </ContainerConfigureInfo>
      <ContainerConfigureInfo title="目录属性">
        <Descriptions column={2}>
          <Descriptions.Item label="创建时间">{data?.createTime ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="更新频率">{data?.refreshFreq.name ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="数据领域分类">
            {data?.knowledgeCatalogDomainName ?? '-'}
          </Descriptions.Item>
          <Descriptions.Item label="关联应用目录">{getParseJson(data?.apps)}</Descriptions.Item>
          <Descriptions.Item label="数据敏感等级">
            {data?.sensitiveLevel.name ?? '-'}
          </Descriptions.Item>
          <Descriptions.Item label="数据来源方">{data?.sourceOrgName ?? '-'}</Descriptions.Item>
          <Descriptions.Item label="使用的数据目录">
            {getParseJson(data?.useCatalogs) ?? '-'}
          </Descriptions.Item>
          <Descriptions.Item label="数据资源摘要">{data?.descrip ?? '-'}</Descriptions.Item>
        </Descriptions>
      </ContainerConfigureInfo>
    </>
  );
};
